#ifndef SYS_MTREENODE_H 
#define SYS_MTREENODE_H 1

#include "mTree.h"

/** This struct combines the MTreeObject, MTreeNode and RoutableObject 
    classes from the java side. **/

#define ISNULL -1

/** Public data structure definitions. */

struct mTreeNode {
  int   parent;   /*mTreeNode*/
  int   children[MTREE_BFACTOR]; /*mTreeNode*/
  double radius;
  double pDistance;
  int   dbObject; /*dbObject */
  char isLeaf;
};

/**
   Want mTreeNode to be private, but need to allow sizeof(mTreeNode) to be available outside of
   mTreeNode.
**/
int mTreeNode_sizeof();

//int mTreeNode_insert(struct mTree * tree, int node, void * object, off_t storeNumber);
int mTreeNode_insert(struct mTree * tree, off_t node, struct mTreeNode * node_ptr,
                     off_t object, void * object_ptr, double distanceToNode) ;
void mTreeNode_query(const struct mTree * tree, const struct mTreeNode* node_ptr, 
		     void * queryObject, const double queryDist, 
                     void (*processHit)(void *, void *), void * state);

void mTreeNode_print(struct mTree * tree, int node, int depth);
int mTreeNode_size(const struct mTree * tree, const struct mTreeNode * node_ptr);

void mTreeNode_verify(struct mTree* tree, off_t node, struct mTreeNode * node_ptr);

#endif /* SYS_MTREENODE_H */
